package com.company.http;

import java.io.*;
import java.net.Socket;

public class ClientConnection implements Runnable {

    /*private static final String METHOD_GET = "GET";
    private static final String METHOD_HEAD = "HEAD";
    private static final String METHOD_POST = "POST";
    private static final String METHOD_PUT = "PUT";
    private static final String METHOD_DELETE = "DELETE";*/

    private Socket socket;
    private InputStream in = null;
    private OutputStream out = null;


    public ClientConnection(Socket socket) throws IOException {
        this.socket = socket;
        initialize();
    }

    public void initialize() throws IOException {
        in = socket.getInputStream();
        out = socket.getOutputStream();
    }

    @Override
    public void run() {
        /*try {
            //
        } catch(IOException e) {
            e.printStackTrace();
        } finally {
            try {
                socket.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        } */
    }

    public static String doGet() {
        StringBuffer buffer = new StringBuffer();
        buffer.append("<html>");
        buffer.append("<head>");
        buffer.append("<title>Header</title>");
        buffer.append("</head>");
        buffer.append("<body>");
        buffer.append("<h1>Example servlet</h1>");
        buffer.append("</body>");
        buffer.append("</html>");
        return buffer.toString();
    }
}